package com.zito.health.controller;

import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.common.result.VerifyResult;
import com.zito.health.entity.LaboratoryEquipment;
import com.zito.health.service.LaboratoryEquipmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: 实验室设备
 * @author: gxt
 * @time: 2019/11/11 11:22
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/laboratoryEquipment")
public class LaboratoryEquipmentController {

    @Autowired
    private LaboratoryEquipmentService laboratoryEquipmentService;

    @PostMapping
    public VerifyResult save(LaboratoryEquipment laboratoryEquipment){
        VerifyResult verifyResult = new VerifyResult();
        laboratoryEquipmentService.save(laboratoryEquipment);
        return verifyResult;
    }
    @PutMapping
    public VerifyResult update(LaboratoryEquipment laboratoryEquipment){
        VerifyResult verifyResult = new VerifyResult();
        laboratoryEquipmentService.update(laboratoryEquipment);
        return verifyResult;
    }

    @GetMapping
    public List<LaboratoryEquipment> list(LaboratoryEquipment laboratoryEquipment){
        return laboratoryEquipmentService.query(laboratoryEquipment);
    }

    @DeleteMapping("/{id}")
    public VerifyResult delete(@PathVariable Integer id){
        VerifyResult verifyResult = new VerifyResult();
        laboratoryEquipmentService.delete(id);
        return verifyResult;
    }
}
